Conversation
📝 WalkthroughWalkthroughThe Mattermost plugin manifest version was bumped from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@webapp/src/components/link_tooltip/link_tooltip.jsx`:
- Around line 37-65: Add the new i18n keys introduced in link_tooltip.jsx —
tooltip.title, tooltip.sharedVia, and tooltip.description — to the English
locale catalogue (en JSON) with the same text as their defaultMessage values
(e.g., "Demo Link Preview", "Shared via {link}", "This is a sample description.
Visit {link} for more details.") so translators can see them; ensure the keys
match exactly and run the i18n extractor/update process if your workflow
requires it.
- Around line 12-13: Replace the naive substring check on this.props.href in
link_tooltip.jsx with a proper hostname comparison: parse the URL using the URL
constructor inside a try/catch (to handle invalid URLs), extract url.hostname,
and return null unless hostname === 'example.com' (or whatever exact domain you
intend to allow); remove the this.props.href.includes(...) check and use this
new parsed-hostname validation so hosts like "example.com.evil.test" or URIs
with query params won't pass.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9a2d8c39-07f3-456c-818c-d49e23a2532d
📒 Files selected for processing (2)
plugin.jsonwebapp/src/components/link_tooltip/link_tooltip.jsx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
webapp/src/components/link_tooltip/link_tooltip.jsx (1)
61-63: Consider using the actual hostname instead of hardcoding.Line 62 hardcodes
'example.com'for the "Shared via" link text. If a subdomain likesub.example.comis used, the display would be slightly misleading. Since you already have the parsed hostname, you could use it here for accuracy.♻️ Suggested change
<a href={this.props.href} target='_blank' rel='noopener noreferrer' data-testid='demo-tooltip-shared-via-link' > - {'example.com'} + {hostname} </a>Note: This would require moving
hostnameto be accessible in the render scope (it already is from the parsing block at the top ofrender()).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@webapp/src/components/link_tooltip/link_tooltip.jsx` around lines 61 - 63, The link text currently hardcodes 'example.com' in the render output; change it to use the parsed hostname variable (hostname) so the "Shared via" anchor displays the real host (including subdomains). Make hostname available in render scope (it already exists in the parsing block) and replace the literal string in the JSX anchor text with the hostname variable used when building the link.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@webapp/src/components/link_tooltip/link_tooltip.jsx`:
- Around line 61-63: The link text currently hardcodes 'example.com' in the
render output; change it to use the parsed hostname variable (hostname) so the
"Shared via" anchor displays the real host (including subdomains). Make hostname
available in render scope (it already exists in the parsing block) and replace
the literal string in the JSX anchor text with the hostname variable used when
building the link.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b08f60c-e44d-47d3-a353-6ee9dba8bf68
📒 Files selected for processing (3)
webapp/i18n/en.jsonwebapp/i18n/es.jsonwebapp/src/components/link_tooltip/link_tooltip.jsx
✅ Files skipped from review due to trivial changes (2)
- webapp/i18n/es.json
- webapp/i18n/en.json
Summary
Ticket Link
None, ref: mattermost/mattermost#36056 (comment)
Screenshot